<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.google.code.facebookapi.FacebookException"%>
<%@ page import="com.google.code.facebookapi.FacebookJaxbRestClient"%>
<%@ page import="com.google.code.facebookapi.Permission"%>
<%@ page import="com.facebook.FaceBookFun"%>
<%@ page import="java.lang.*"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>NCCU KLP</title>

<style type="text/css">
<!--
body { 
	background-image: url("../fbimg/fbclick1.jpg"); 
	background-repeat:no-repeat;
}

#button{
  background:url( ../fbimg/click1.jpg ) no-repeat;
  margin:0px 20px;
  width:260px;
  height:90px;
  display:block;
  border:0px;
}

#button:hover{
 background:url( ../fbimg/click.jpg ) no-repeat;
}


#Layer1 {
	position:absolute;
	width:270px;
	height:90px;
	z-index:1;
	left: 231px;
	top: 176px;
}

ul {
list-style-type:none;
/* 去除項目清單的小黑點 */
margin:0; 
/* 清除項目清單的外間距 */
padding:0; 
/* 清除項目清單的內間距 */
}

li {
}

li a {
display:block; 
/* 將超連結設定為區塊模式 */
width:250px; 
/* 設定超連結區塊的寬度 */
height:80px; 
/* 設定超連結區塊的高度 */
background-image:url("../fbtest/button.jpg"); 
/* 設定超連結區塊的背景圖片 */
line-height:80px; 
/* 設定超連結區塊的行高 */
text-indent:1px; 
/* 設定超連結區塊的文字內縮 */
text-decoration:none; 
/* 去除超連結的底線 */
color:#333333;
font-size:15px;
font-family:Arial,細明體;
}

li a:hover {
background-position:left bottom; 
/* 設定滑鼠摸到超連結區塊的背景圖片的位置 */
color:#003366; 
/* 設定滑鼠摸到超連結區塊的文字顏色 */
}

-->
</style>

</head>

<%
	FacebookJaxbRestClient fbclient = (FacebookJaxbRestClient)session.getAttribute("FacebookClient");
	FaceBookFun fbFun = new FaceBookFun();
	fbFun.setFbClient(fbclient);
	fbFun.setFB_id(fbclient.users_getLoggedInUser());	
%>

<script type="text/javascript">	

	function openWindow(){
		<%//fbFun.publication(fbclient,msg);%>
		window.open('FaceBookloginServlet', 'KLP', 'height=650,width=900,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=yes');
		}

	function openNewWindow(page, qid){
		window.open('http://140.119.19.171:8080/KLP_View/KLP.swf'+'?page='+page+'&qid='+qid, 'KLP', config='height=650,width=900');
		}

	window.onload   =   init(); 

	function init(){

		var url=window.location.toString();
		var str="";
		var page=0;
		var qid=0;
		
		if(url.indexOf("?")!=-1){ //url裡有"?"符號
		  var ary=url.split("?")[1].split("&");

		  if(ary[0].split("=")[0] == "page"){
			  page = ary[0].split("=")[1];
			  qid = ary[1].split("=")[1];

			  openNewWindow(page,qid);
		  }
		  
		  for(var i in ary){
		    str+=ary[i].split("=")[0]+":"; //變數名稱
		    str+=ary[i].split("=")[1]+"\n"; //變數值
		  }		  
		}else{ //url裡沒有"?"符號
		  str+="沒有get變數\n";
		}
	}


		
</script>

<body>
<div id="Layer1" align="center">
	<a href='' id='button' onClick="openWindow()"></a>	
</div>
</body>
</html>